package com.resou.reader.api.entry;

import android.os.Parcel;
import android.os.Parcelable;

import org.litepal.LitePal;
import org.litepal.crud.LitePalSupport;

/**
 * Author: 萤火虫
 * E-mail:  Allensuns@163.com
 * Description:
 * CreateTime: 2019-04 -12
 **/
public class LocalPrase extends LitePalSupport implements Parcelable {
    private String commentId;
    private boolean isPraise = false;

    public LocalPrase() {
    }

    protected LocalPrase(Parcel in) {
        commentId = in.readString();
        isPraise = in.readByte() != 0;
    }

    public static final Creator<LocalPrase> CREATOR = new Creator<LocalPrase>() {
        @Override
        public LocalPrase createFromParcel(Parcel in) {
            return new LocalPrase(in);
        }

        @Override
        public LocalPrase[] newArray(int size) {
            return new LocalPrase[size];
        }
    };

    public String getCommentId() {
        return commentId;
    }

    public void setCommentId(String commentId) {
        this.commentId = commentId;
    }

    public boolean isPraise() {
        return isPraise;
    }

    public void setPraise(boolean praise) {
        isPraise = praise;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(commentId);
        dest.writeByte((byte) (isPraise ? 1 : 0));
    }
}
